//---------------------------------------------------------------------------
#ifndef CPFatH
#define CPFatH

//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "Cadpad.h"
#include "CGAUGES.h"
#include "PHDS.h"
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include "PHGridEd.h"
#include <Grids.hpp>
#include "PHEdit.h"
#include "PHLabel.h"
#include "PHSpdBut.h"
#include "Word_2K_SRVR.h"
#include <OleServer.hpp>
#include "DMFat.h"
#include "PHCombo.h"
#include "Geracao.h"
#include "Emissao.h"

//---------------------------------------------------------------------------
class TCPFat1 : public TCadPad1
{
__published:  // IDE-managed Components
        PHGridEdit *GridServicos;
        PHGridEdit *GridRetencoes;
  PHDataSource*  DSServ;
  PHDataSource*  DSRet;
  PHLabel*  PHLabel1;
  PHEdit*  PHEdit1;
  PHSpeedButton*  PHSpeedButton1;
  PHEdit*  PHEdit2;
  TLabel*  Label1;
  TLabel*  Label2;
  TButton*  Button1;
  TBitBtn*  BitBtn2;
  TBitBtn*  BitBtn3;
  TBitBtn*  BitBtn4;
  TBitBtn*  BitBtn5;
  TWordApplication*  W1;
  TWordDocument*  WD1;
  TLabel*  Label5;
  TLabel*  Label6;
  TLabel*  Label7;
  TLabel*  Label8;
  TLabel*  Label9;
  TLabel*  Label10;
  TStaticText*  STBruto;
  TStaticText*  STRet;
  TStaticText*  STLiquido;
  TStaticText*  STRetA;
  TStaticText*  STLiqC;
  TLabel*  Label11;
  PHLabel*  PHLabel4;
  PHEdit*  PHEdit5;
  TBitBtn*  BitBtn6;
  PHLabel*  PHLabel2;
  PHEdit*  PHEdit3;
  PHEdit*  PHEdit4;
    PHLabel *PHLabel3;
    PHComboBox *PHComboBox1;
        TSpeedButton *SpeedButton22;
 TBitBtn *BitBtn7;
 PHLabel *PHLabel5;
 PHEdit *PHEdit6;
 PHLabel *PHLabel6;
 PHEdit *PHEdit7;
 PHLabel *PHLabel7;
 PHEdit *PHEdit8;
  void __fastcall FormDestroy( TObject* Sender );
  void __fastcall Button1Click( TObject* Sender );
  void __fastcall FormShow( TObject* Sender );
  void __fastcall DSServBeforePost( TObject* Sender );
  void __fastcall DSRetBeforePost( TObject* Sender );
  void __fastcall PHDS1AfterRead( TObject* Sender );
  void __fastcall BitBtn3Click( TObject* Sender );
  void __fastcall PHDS1StateChange( Estados State );
  void __fastcall BitBtn4Click( TObject* Sender );
  void __fastcall DSServBeforeDelete( TObject* Sender );
  void __fastcall PHDS1BeforePost( TObject* Sender );
  void __fastcall DSServAfterPost( TObject* Sender );
  void __fastcall BitBtn5Click( TObject* Sender );
  void __fastcall BitBtn2Click( TObject* Sender );
  void __fastcall PHDS1AfterInsert( TObject* Sender );
  void __fastcall W1Quit( TObject* Sender );
  void __fastcall DSServAfterInsert( TObject* Sender );
  void __fastcall PHDS1BeforeEdit( TObject* Sender );
  void __fastcall DSServBeforeInsert( TObject* Sender );
  void __fastcall DSServBeforeEdit( TObject* Sender );
  void __fastcall BitBtn6Click( TObject* Sender );
  void __fastcall PHDS1AfterOpen( TObject* Sender );
  void __fastcall DSServAfterDelete(TObject *Sender);
  void __fastcall PHDS1AfterPost(TObject *Sender);
  void __fastcall SpeedButton22Click(TObject *Sender);
  void __fastcall BitBtn7Click(TObject *Sender);
 void __fastcall PHEdit1Exit(TObject *Sender);
 void __fastcall PHDS1BeforeDelete(TObject *Sender);
 void __fastcall SpeedButton8Click(TObject *Sender);

  private:  // User declarations
  void __fastcall ProcessaCheck( TObject* Sender );
  void __fastcall AlteraVencimentos(TObject *Sender);
  AnsiString __fastcall PedeMesAno();
  void __fastcall LimpaTotais( void );
  void __fastcall AtualizaTotais( void );
  void __fastcall TotalizaEFPH( void );
  void __fastcall TotalizaDPPH( void );
  void __fastcall CarregaServicos(void);
  void __fastcall DeletaRegistrosFiltrados(TObject *Sender);
  bool __fastcall VerificaRecebimentosFiltrados(void);
  void __fastcall VerificaValorLK(void);
  struct SERVICOS_CONTRATO *ServicosContrato;

  TStringList*  ErrosCheck;
  TStringList *ClientesDevedores;
  PHDataSource *DelFiltrados;
  PHDataSource *DSEmpr;
  AnsiString Filtro;
  bool Calculando;
  bool RegistroAtual;
  struct FAT*  Fat;
  int NovoVencimento;
  TEmissao *Emissao;
  TGeracao *Geracao;
  int LancamentoAlterar;
  int DataAlterar;

  public:  // User declarations
  __fastcall TCPFat1( TComponent* Owner );
  int Flag;
  int MesAno;
};

//---------------------------------------------------------------------------
extern PACKAGE TCPFat1*  CPFat1;
extern PACKAGE TCPFat1*  CPFat2;

//---------------------------------------------------------------------------
#endif

